#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
const int maxn = 1100;
char s[maxn];
char ans[maxn][maxn];
int main()
{
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        cin>>s+1;
        int len=strlen(s+1);
        map<int,map<int,int> >mp;
        for(int i = 1;i<=len-n+1;i++)
       {
            int cnt=0;
            for(int j = i;j<=i+n-1;j++)
            {
                cnt++;
                mp[cnt][s[j]]++;
            }
        }
        for(int i = 1;i<=n;i++)
        {
            if(mp[i]['0']==0)
			{
                cout<<"1";
            }
            else if(mp[i]['1']==0)
			{
                cout<<"0";
            }
            else
			{
                cout<<"1";
            }

        }
        cout<<"\n";
    }
    return 0;
}
